//
//  ViewWalletController.m
//  Wallets Manager
//
//  Created by TungNguyen on 11/18/12.
//  Copyright (c) 2012 BKHN. All rights reserved.
//

#import "ViewWalletController.h"

@interface ViewWalletController ()

@end

@implementation ViewWalletController

@synthesize currentWallet;
@synthesize nameTextField,amoutTextField,currencyTextField,dateTextField,passwordTextField,descriptionTextField,imagePickerButton;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    nameTextField.text = currentWallet.w_name;
    amoutTextField.text = currentWallet.w_balance.stringValue;
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"MM/dd/yyyy"];
    dateTextField.text = [dateFormatter stringFromDate:currentWallet.w_date];
    passwordTextField.text = currentWallet.w_pword;
    descriptionTextField.text = currentWallet.w_description;
    currencyTextField.text = currentWallet.wToCurrency.c_name;
    [imagePickerButton setImage:[UIImage imageNamed:currentWallet.w_image] forState:UIControlStateNormal];

    // Do any additional setup after loading the view from its nib.
    
}

- (void)viewDidUnload
{
    
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction)backButtonPressed:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
